home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / satellit / pb920430 / dofile.bat next >
DOS Batch File  |  1992-04-30  |  3KB  |  183 lines

  1. REM@ECHO OFF
  2. REM
  3. REM dofile.bat
  4. REM This batch file will run under MS-DOS.
  5. REM
  6. REM It first identifies the compression type and stores that in an
  7. REM environment variable C.
  8. REM
  9. REM It then checks the file type and processes different file types
  10. REM appropriately.
  11. REM
  12. REM You must have a directory \msgs off of your main
  13. REM PACSAT operating directory. It puts ASCII readable text into
  14. REM files called nnnn.msg, where nnnn is replaced by the message 
  15. REM number. 
  16. REM
  17. pfh_val %1.dl 25 >nul
  18. if errorlevel 4 goto uct
  19. if errorlevel 3 goto lha
  20. if errorlevel 2 goto zip
  21. if errorlevel 1 goto arc
  22. goto nocomp
  23.  
  24. REM Compression type is ARC
  25. :arc
  26. ECHO Compressed by PKARC
  27. SET C=ARC
  28. goto proc
  29.  
  30. REM Compression type is ZIP
  31. :zip
  32. ECHO Compressed by PKZIP
  33. SET C=ZIP
  34. goto proc
  35.  
  36. REM Compression type is LHARC
  37. :lha
  38. ECHO Compressed by LHZ
  39. SET C=LHA
  40. goto proc
  41.  
  42. REM Compression type is unknown
  43. :uct
  44. ECHO Compressed by an unknown technique.
  45. SET C=UCT
  46. goto proc
  47.  
  48. REM No compression type field in the file
  49. :nocomp
  50. ECHO Message is not compressed.
  51. SET C=NO
  52. goto proc
  53.  
  54. :proc
  55. pfh_val %1.dl 8 >nul
  56.  
  57. if errorlevel 3 goto ubt
  58. if errorlevel 2 goto bbs
  59. if errorlevel 1 goto bbs1
  60. goto text
  61.  
  62. REM Unknown body type.
  63. :ubt
  64. ECHO Unknown message body type.
  65. goto done
  66.  
  67. REM Multiple BBS messages
  68. :bbs
  69. ECHO Message body contains multiple BBS messages
  70. goto done
  71.  
  72. REM Single BBS message
  73. :bbs1
  74. ECHO Message body is a BBS message
  75. goto done
  76.  
  77. :text
  78. ECHO Message body is plain text. Processing.
  79. if "%C%"=="ZIP" goto txtzip
  80. if "%C%"=="ARC" goto txtarc
  81. if "%C%"=="LHA" goto txtlha
  82. if "%C%"=="UCT" goto txtuct
  83. if "%C%"=="NO" goto txtno
  84. goto err
  85.  
  86. :txtno
  87. REM Uncompressed ASCII text message.
  88. phs %1.dl /s /o msgs\%1.msg /t /x
  89. goto done
  90.  
  91. :txtzip
  92. REM Zipped ASCII text message.
  93. REM Gets the .zip file from the PACSAT message
  94. phs %1.dl /s /o %1.zip /x
  95. REM
  96. REM Unzipps it to the screen, but redirects the screen to a .msg file.
  97. pkunzip /c %1.zip >msgs\%1.msg
  98. REM
  99. REM Deletes the .zip file
  100. del %1.zip
  101. goto done
  102.  
  103. :txtarc
  104. REM Arc'ed ASCII text message.
  105. goto done
  106.  
  107. :txtlha
  108. REM Lharced ASCII text message.
  109. REM LHArced ASCII text message.
  110. REM Gets the .lhz file from the PACSAT message
  111. phs %1.dl /s /o %1.lzh /x
  112. REM
  113. REM decompress it to the screen, but redirect to a .msg file.
  114. lha p %1.lzh >msgs\%1.msg
  115. REM
  116. REM Deletes the .lzh file
  117. del %1.lzh
  118.  
  119. goto done
  120.  
  121. :txtuct
  122. REM Text message with unknown compression type.
  123. ECHO Unknown compression type on text file
  124. goto done
  125.  
  126. :bbs
  127. if "%C%"=="ZIP" goto bbszip
  128. if "%C%"=="ARC" goto bbsarc
  129. if "%C%"=="LHA" goto bbslha
  130. if "%C%"=="UCT" goto bbsuct
  131. if "%C%"=="NO" goto bbsno
  132. goto err
  133.  
  134. :bbsno
  135. goto done
  136.  
  137. :bbszip
  138. goto done
  139.  
  140. :bbsarc
  141. goto done
  142.  
  143. :bbslha
  144. goto done
  145.  
  146. :bbsuct
  147. goto done
  148.  
  149. :bbs1
  150. if "%C%"=="ZIP" goto bbs1zip
  151. if "%C%"=="ARC" goto bbs1arc
  152. if "%C%"=="LHA" goto bbs1lha
  153. if "%C%"=="UCT" goto bbs1ct
  154. if "%C%"=="NO" goto bbs1no
  155. goto err
  156.  
  157. :bbs1no
  158. phs %1.dl /s /o msgs\%1.msg /h /x
  159. goto done
  160.  
  161. :bbs1zip
  162. goto done
  163.  
  164. :bbs1arc
  165. goto done
  166.  
  167. :bbs1lha
  168. goto done
  169.  
  170. :bbs1uct
  171. goto done
  172.  
  173. :err
  174. REM error
  175. ECHO There was an error!
  176. :done
  177. xcopy %1.dlx dlxfiles >nul
  178. if errorlevel 1 goto end
  179. del %1.dlx
  180. :end
  181. set c=
  182.  
  183.